﻿using System;
using ContentAppBase.Common;
using ContentAppBase.ViewModel;
using Windows.System;
using Windows.UI.ApplicationSettings;
using Windows.UI.Xaml;

namespace ContentAppBase.Utils
{
    public static class AppHelper
    {
        public static void Init()
        {
            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("ms-appx:///ContentAppBase/Common/StandardStyles.xaml", UriKind.Absolute) });
            Application.Current.Resources.Add("Locator", new ViewModelLocator());
            Application.Current.Resources.Add("BooleanToVisibilityConverter", new BooleanToVisibilityConverter());
            Application.Current.Resources.Add("TestConverter", new TestConverter());

            SettingsPane.GetForCurrentView().CommandsRequested += SettingsHelper_CommandsRequested;
        }

        static void SettingsHelper_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
        {
            string _privacyLink = (String)Application.Current.Resources["PrivacyLink"];
            args.Request.ApplicationCommands.Add(new SettingsCommand("Privacy", "Datenschutz", (e) => Launcher.LaunchUriAsync(new Uri(_privacyLink))));
        }
    }
}
